package com.nineclock.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nineclock.system.pojo.SysCompanyUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface SysCompanyUserMapper extends BaseMapper<SysCompanyUser> {

    /**
     * 获取当前企业的主管理员
     * @return
     */
    @Select("select cu.* from sys_company_user cu INNER JOIN sys_company_user_role cur INNER JOIN sys_role r " +
            " on r.id = cur.role_id and cur.company_user_id = cu.id " +
            " where r.company_id = #{companyId} and r.role_name = 'ROLE_ADMIN_SYS'")
    public SysCompanyUser queryMainAdminCompanyUser(@Param("companyId") Long companyId);
}
